let questionListArr = [
    { id: 1, serialNumber: 1, testQuestionStem: "《如梦令》是我国宋代诗人李清照的作品", testQuestionType: "判断题", difficulty: "困难" },
    { id: 2, serialNumber: 2, testQuestionStem: "《如梦令》是我国宋代诗人李清照的作品", testQuestionType: "判断题", difficulty: "一般" },
    { id: 3, serialNumber: 3, testQuestionStem: "《如梦令》是我国宋代诗人李清照的作品", testQuestionType: "判断题", difficulty: "一般" },
    { id: 4, serialNumber: 4, testQuestionStem: "《如梦令》是我国宋代诗人李清照的作品", testQuestionType: "判断题", difficulty: "困难" },
    { id: 5, serialNumber: 5, testQuestionStem: "《如梦令》是我国宋代诗人李清照的作品", testQuestionType: "判断题", difficulty: "一般" },
    { id: 6, serialNumber: 6, testQuestionStem: "《陈情令》是我国宋代诗人李清照的作品", testQuestionType: "判断题", difficulty: "一般" },
    { id: 7, serialNumber: 7, testQuestionStem: "《如梦令》是我国宋代诗人李清照的作品", testQuestionType: "选择题", difficulty: "困难" },
    { id: 8, serialNumber: 8, testQuestionStem: "《如梦令》是我国宋代诗人李清照的作品", testQuestionType: "判断题", difficulty: "一般" },
    { id: 9, serialNumber: 9, testQuestionStem: "《如梦令》是我国宋代诗人李清照的作品", testQuestionType: "判断题", difficulty: "一般" },
    { id: 10, serialNumber: 10, testQuestionStem: "《如梦令》是我国宋代诗人李清照的作品", testQuestionType: "判断题", difficulty: "一般" },
    { id: 11, serialNumber: 11, testQuestionStem: "《如梦令》是我国宋代诗人李清照的作品", testQuestionType: "判断题", difficulty: "一般" },
    { id: 12, serialNumber: 12, testQuestionStem: "《如梦令》是我国宋代诗人李清照的作品", testQuestionType: "选择题", difficulty: "困难" },
    { id: 13, serialNumber: 13, testQuestionStem: "《如梦令》是我国宋代诗人李清照的作品", testQuestionType: "判断题", difficulty: "一般" },
    { id: 14, serialNumber: 14, testQuestionStem: "《如梦令》是我国宋代诗人李清照的作品", testQuestionType: "判断题", difficulty: "一般" }

]
let id = questionListArr.length;
let oTbody = document.querySelector('tbody');
let oTzdiv = document.querySelector('.tz-page-div');
let delBtn = document.querySelector('.del-btn');
let searchBtn = document.querySelector('.search-btn');
let searchCon1 = document.querySelector('.search-con1');
let searchCon2 = document.querySelector('.search-con2');
let searchCon3 = document.querySelector('.search-con3');


let addBtn = document.querySelector('.add-btn');
let addSerialNumber = document.querySelector('.add-serialNumber');
let addTestQuestionStem = document.querySelector('.add-testQuestionStem');
let addTestQuestionType = document.querySelector('.add-testQuestionType');
let editBtn = document.querySelector('.edit-btn');
let editSerialNumber = document.querySelector('.edit-serialNumber');
let editTestQuestionStem = document.querySelector('.edit-testQuestionStem');
let editTestQuestionType = document.querySelector('.edit-testQuestionType');
let editSelection = document.querySelectorAll('.edit-selection')
let cheksBox = document.querySelector('.cheks-box')
let emptyBtn = document.querySelector('.empty-btn');
let oInquire3 = document.querySelector('#Inquire3');
let cheBox = document.getElementsByName('che-box');
// let n = questionArr.length - 1;
let count = 5; //每页的个数
let count2 = 4; //每页的个数
let count3 = 3; //每页的个数
let iNow = 1; //当前页数
let show;   //显示页面
let i = document.querySelector('i');
let jump = document.querySelector('.jump');
let pageSres = document.querySelector('#pagesres')
let delId = 0;
let editId = 0;
function render(iNow, num, arr) {
    //判断每页条数
    if (show == count) {
        num = count;
    } else if (show == count2) {
        num = count2;

    } else if (show == count3) {
        num = count3

    } else {
        num = count;
    }

    //创建内容
    let str = ''
    let renderData = arr.slice((iNow - 1) * num, iNow * num);
    for (let i = 0; i < renderData.length; i++) {
        str += `<tr>
                                    <td><input type="checkbox" name="che-box" id="inlineCheckbox1" value="option1"></td>
                                    <td>${renderData[i].serialNumber}</td>
                                    <td>${renderData[i].testQuestionStem}</td>
                                    <td>${renderData[i].testQuestionType}</td>
                                    <td>${renderData[i].difficulty}</td>
                                    <td data-id="${renderData[i].id}">
                                    <button data-toggle="modal" data-target="#delModal" class="btn btn-danger del">删除</button>
                                    <button class="btn btn-warning edit" data-toggle="modal" data-target="#editModal">修改</button>
                                    <button class="btn btn-warning edit" data-toggle="modal" data-target="#editModal">详情</button>
                                    </td>
                              </tr>
        `


    }
    oTbody.innerHTML = str;
    //创建页码
    let pagesLeft = `<button class="left"><span class="glyphicon glyphicon-menu-left left" aria-hidden="true"></span></button>`
    let pagesRight = `<button class="right"><span class="glyphicon glyphicon-menu-right right" aria-hidden="true"></span></button>`
    //创建每页多少条
    var pagesres = ``
    //如果点击的是页码，在让当前页码显示
    let pagesStr = ''
    for (let i = 1; i <= Math.ceil(arr.length / num); i++) {
        if (iNow == i) {
            pagesStr += `<button class="active-s yeam">${i}</button>`
        } else {
            pagesStr += `<button class="yeam">${i}</button>`
        }
    }
    oTzdiv.innerHTML = pagesLeft + pagesStr + pagesRight


}


//页面加载就渲染
render(iNow, show, questionListArr)

//分页功能
oTzdiv.addEventListener('click', function (e) {

    if (e.target.className.includes('left')) {//左


        if (iNow > 1) {
            iNow--;
            render(iNow, show, questionListArr)
        }

    } else if (e.target.className.includes('right')) {//右
        if (iNow < Math.ceil(questionListArr.length / count)) {
            iNow++;
            render(iNow, show, questionListArr)

        }


    } else if (e.target.className.includes('yeam')) { //数字键
        console.log('dain');
        iNow = e.target.innerText.trim();
        render(iNow, show, questionListArr)
    }
});
//跳转的功能
function JumpPage() {
    let pages = Math.ceil(questionListArr.length / count);
    if (1 <= jump.value && jump.value <= pages) {
        render(jump.value, show, questionListArr)
    }
}
i.addEventListener('click', JumpPage);
jump.addEventListener('keyup', JumpPage);
//增加页数显示条件改变的功能
function changepage() {
    let src = pageSres.value
    switch (src) {
        case "5":
            show = count;
            render(iNow, show, questionListArr);
            break;
        case "4":
            show = count2
            render(iNow, show, questionListArr);
            break;
        case "3":
            show = count3
            render(iNow, show, questionListArr);
            break;

    }
}

//所有的删除添加事件
oTbody.addEventListener('click', function (e) {
    //删除
    if (e.target.className.includes('del')) {
        delId = e.target.parentNode.dataset.id
    } else if (e.target.className.includes('edit')) {
        //显示编辑框，赋值

        editSerialNumber.value = e.target.parentNode.parentNode.children[1].innerText;
        editTestQuestionStem.value = e.target.parentNode.parentNode.children[2].innerText;
        editTestQuestionType.value = e.target.parentNode.parentNode.children[3].innerText;
        if (e.target.parentNode.parentNode.children[4].innerText == '困难') {

            editSelection[0].checked = true;

        } else if (e.target.parentNode.parentNode.children[4].innerText == '简单') {
            editSelection[1].checked = true;

        } else {
            editSelection[2].checked = true;
        }






        editId = e.target.parentNode.dataset.id;
        console.log(editId);

    }
})

// //点删除确定的时候
delBtn.addEventListener('click', function () {
    for (let i = 0; i < questionListArr.length; i++)
        if (questionListArr[i].id == delId) {
            questionListArr.splice(i, 1);

            let renderData = questionListArr.slice((iNow - 1) * count, iNow * count);
            if (renderData.length == 0 && iNow > 1) {
                iNow--;
            }
            render(iNow, show, questionListArr);
            return;
        }
})

// //跳转页面事件
pageSres.addEventListener('click', changepage)
//搜索按钮
searchBtn.addEventListener('click', function () {
    let finderArr1 = [];
    let finderArr2 = [];
    let finderArr3 = [];
    let str1 = searchCon1.value;
    let str2 = searchCon2.value;
    let str3 = searchCon3.value;
    if (str1.trim() != '') {
        for (let i = 0; i < questionListArr.length; i++) {
            if (questionListArr[i].testQuestionStem.includes(str1)) {
                finderArr1.push(questionListArr[i]);
            }

        }
    } else {
        finderArr1 = questionListArr;
        console.log(finderArr1);

    }
    if (str2 != '') {
        for (let i = 0; i < finderArr1.length; i++) {
            if (finderArr1[i].testQuestionType.includes(str2)) {
                finderArr2.push(finderArr1[i]);
            }
        }
    } else {
        finderArr2 = finderArr1;
    }

    if (str3 != '') {
        for (let i = 0; i < finderArr2.length; i++) {
            if (finderArr2[i].difficulty.includes(str3)) {
                finderArr3.push(finderArr2[i]);
            }

        }
    } else {
        finderArr3 = finderArr2;

    }
    render(iNow, show, finderArr3)

})

//点击添加的时候
addBtn.addEventListener('click', function () {
    questionListArr.push({
        id: ++id,
        serialNumber: addSerialNumber.value,
        testQuestionStem: addTestQuestionStem.value,
        testQuestionType: addTestQuestionType.value,
        difficulty: document.querySelector('.add-selection:checked').value

    })

})

//点击修改的时候
editBtn.addEventListener('click', function () {
    console.log(1);

    let json = {
        id: editId,
        serialNumber: editSerialNumber.value,
        testQuestionStem: editTestQuestionStem.value,
        testQuestionType: editTestQuestionType.value,
        difficulty: document.querySelector('.edit-selection:checked').value





    }
    for (let i = 0; i < questionListArr.length; i++) {
        if (questionListArr[i].id == editId) {
            questionListArr.splice(i, 1, json)

        }

    }
    render(iNow, show, questionListArr)
    console.log(json);
})

//清空按钮
emptyBtn.addEventListener('click', function () {
    searchCon1.value = '';
    searchCon2.value = '';
    searchCon3.value = '';


    render(iNow, show, questionListArr)

})

// 批量删除
oInquire3.addEventListener('click', function () {
    for (let i = n; i >= 0; i--) {
        for (let i = 0; i < cheBox.length; i++) {
            if (cheBox[i].checked == true) {
                cheBox[i].parentNode.parentNode.remove();


            }
        }
    }

})

// 全选的删除
cheksBox.addEventListener('click', function () {
    for (let i = 0; i < cheBox.length; i++) {
        cheBox[i].checked = this.checked;

    }
})



// -------------------左边下拉框-----------------------------------------------------------------------------
//  左边js
let tzpapermanageleft = document.querySelector(".papermanageleft");
let tzpapermanagewait = '';
let tzstr4all = '';
tzpapermanageleft.addEventListener("click", function () {
    if (event.target.className.includes("papermanagefirstorder")) {
        if (event.target.nodeName == "UL") {
            if (event.target.children[0].className.includes("glyphicon-plus-sign")) {
                event.target.children[0].classList.remove("glyphicon-plus-sign");
                event.target.children[0].classList.add("glyphicon-minus-sign");
                for (let i = 4; i < event.target.children.length; i++) {
                    event.target.children[i].style.display = "block";
                }
            } else {
                event.target.children[0].classList.remove("glyphicon-minus-sign");
                event.target.children[0].classList.add("glyphicon-plus-sign");
                for (let i = 4; i < event.target.children.length; i++) {
                    event.target.children[i].style.display = "none";
                }
            }
        } else if (event.target.className.includes("glyphicon-plus-sign")) {
            event.target.classList.remove("glyphicon-plus-sign");
            event.target.classList.add("glyphicon-minus-sign");
            for (let i = 4; i < event.target.parentNode.children.length; i++) {
                event.target.parentNode.children[i].style.display = "block";
            }
        } else if (event.target.className.includes("glyphicon-minus-sign")) {
            event.target.classList.remove("glyphicon-minus-sign");
            event.target.classList.add("glyphicon-plus-sign");
            for (let i = 4; i < event.target.parentNode.children.length; i++) {
                event.target.parentNode.children[i].style.display = "none";
            }
        } else if (event.target.className.includes("glyphicon-plus")) {
            event.target.previousElementSibling.classList.remove("glyphicon-plus-sign");
            event.target.previousElementSibling.classList.add("glyphicon-minus-sign");
            for (let i = 4; i < event.target.parentNode.children.length; i++) {
                event.target.parentNode.children[i].style.display = "block";
            };
            let tznewsecondorder = `<li class="papermanagesecondorder newpaper" style="display: block">
                  <span class="glyphicon glyphicon-plus-sign papermanagesecondorder" aria-hidden="true"></span>
                  <input type="text">
                  <span class="glyphicon glyphicon-remove papermanagesecondorder" aria-hidden="true"></span>
                  <span class="glyphicon glyphicon-ok papermanagesecondorder" aria-hidden="true"></span>
                  <span class="glyphicon glyphicon-pencil papermanagesecondorder" aria-hidden="true"></span><ul>
                  <li style="dispaly:block">月考试卷</li>
                  <li style="dispaly:block">期末测试试卷</li>
                </ul>
                </li>`;
            event.target.parentNode.innerHTML += tznewsecondorder;
        } else if (event.target.className.includes("glyphicon-minus")) {
            event.target.classList.remove("glyphicon-minus");
            event.target.classList.add("glyphicon-check");
            event.target.previousElementSibling.previousElementSibling.classList.remove("glyphicon-plus-sign");
            event.target.previousElementSibling.previousElementSibling.classList.add("glyphicon-minus-sign");
            for (let i = 4; i < event.target.parentNode.children.length; i++) {
                event.target.parentNode.children[i].style.display = "block";
                event.target.parentNode.children[i].children[1].classList.remove("glyphicon-plus");
                event.target.parentNode.children[i].children[1].classList.add("glyphicon-remove");
                event.target.parentNode.children[i].children[2].classList.remove("glyphicon-minus");
                event.target.parentNode.children[i].children[2].classList.add("glyphicon-ok");
            }
        } else if (event.target.className.includes("glyphicon-check")) {
            event.target.classList.remove("glyphicon-check");
            event.target.classList.add("glyphicon-minus");
            for (let i = 4; i < event.target.parentNode.children.length; i++) {
                event.target.parentNode.children[i].style.display = "block";
                event.target.parentNode.children[i].children[1].classList.remove("glyphicon-remove");
                event.target.parentNode.children[i].children[1].classList.add("glyphicon-plus");
                event.target.parentNode.children[i].children[2].classList.remove("glyphicon-ok");
                event.target.parentNode.children[i].children[2].classList.add("glyphicon-minus");
            }
        } else if (event.target.className.includes("glyphicon-pencil")) {
            tzpapermanagewait = event.target.parentNode.childNodes[2].textContent;
            console.log(event.target.parentNode.children[0]);
            tzstr4all = event.target.parentNode.children[0].dataset.name;
            event.target.previousElementSibling.previousElementSibling.classList.remove("glyphicon-plus");
            event.target.previousElementSibling.previousElementSibling.classList.add("glyphicon-remove");
            event.target.previousElementSibling.classList.remove("glyphicon-minus");
            event.target.previousElementSibling.classList.add("glyphicon-ok");
            for (let i = 0; i < event.target.parentNode.childNodes.length; i++) {
                if (event.target.parentNode.childNodes[i].nodeName == "SPAN" && event.target.parentNode.childNodes[i].className.includes("glyphicon-remove")) {
                    break;
                } else {
                    event.target.parentNode.removeChild(event.target.parentNode.childNodes[i]);
                    i--;
                }
            }
            event.target.parentNode.innerHTML =
                ` <span class="glyphicon glyphicon-plus-sign papermanagefirstorder" aria-hidden="true" data-name="${tzstr4all}"></span>
          ${tzstr4all}<input type="text" class="tzpapermanagecount">` +
                event.target.parentNode.innerHTML;
        } else if (event.target.className.includes("glyphicon-ok")) {
            if (event.target.parentNode.children[1].value != '') {
                tzstr4all = event.target.parentNode.children[0].dataset.name;
                event.target.previousElementSibling.classList.remove("glyphicon-remove");
                event.target.previousElementSibling.classList.add("glyphicon-plus");
                event.target.classList.remove("glyphicon-ok");
                event.target.classList.add("glyphicon-minus");
                let str2 = event.target.parentNode.childNodes[3].value;
                event.target.parentNode.removeChild(event.target.parentNode.childNodes[1]);
                event.target.parentNode.removeChild(event.target.parentNode.childNodes[1]);
                event.target.parentNode.removeChild(event.target.parentNode.childNodes[1]);
                event.target.parentNode.innerHTML =
                    ` <span class="glyphicon glyphicon-plus-sign papermanagefirstorder" aria-hidden="true" data-name="${tzstr4all}"></span>
          ${tzstr4all}(${str2})` + event.target.parentNode.innerHTML;
            }
        } else if (event.target.className.includes("glyphicon-remove")) {
            event.target.classList.remove("glyphicon-remove");
            event.target.classList.add("glyphicon-plus");
            event.target.nextElementSibling.classList.remove("glyphicon-ok");
            event.target.nextElementSibling.classList.add("glyphicon-minus");
            event.target.parentNode.removeChild(event.target.parentNode.childNodes[1]);
            event.target.parentNode.removeChild(event.target.parentNode.childNodes[1]);
            event.target.parentNode.removeChild(event.target.parentNode.childNodes[1]);
            event.target.parentNode.innerHTML =
                ` <span class="glyphicon glyphicon-plus-sign papermanagefirstorder" aria-hidden="true" data-name="${tzstr4all}"></span>${tzpapermanagewait}` +
                event.target.parentNode.innerHTML;
        }
    }
    //////////////////////////////////////////////////////////////////////////////////////////////////////////
    if (event.target.className.includes("papermanagesecondorder")) {
        if (event.target.nodeName == "LI") {
            if (event.target.children[0].className.includes("glyphicon-plus-sign")) {
                event.target.children[0].classList.remove("glyphicon-plus-sign");
                event.target.children[0].classList.add("glyphicon-minus-sign");
                for (let i = 0; i < event.target.children[4].children.length; i++) {
                    event.target.children[4].children[i].style.display = "block";
                }
            } else {
                event.target.children[0].classList.remove("glyphicon-minus-sign");
                event.target.children[0].classList.add("glyphicon-plus-sign");
                for (let i = 0; i < event.target.children[4].children.length; i++) {
                    event.target.children[4].children[i].style.display = "none";
                }
            }
        } else if (event.target.className.includes("glyphicon-plus-sign")) {
            event.target.classList.remove("glyphicon-plus-sign");
            event.target.classList.add("glyphicon-minus-sign");
            for (let i = 0; i < event.target.parentNode.children[4].children.length; i++) {
                event.target.parentNode.children[4].children[i].style.display = "block";
            }
        } else if (event.target.className.includes("glyphicon-minus-sign")) {
            event.target.classList.remove("glyphicon-minus-sign");
            event.target.classList.add("glyphicon-plus-sign");
            for (let i = 0; i < event.target.parentNode.children[4].children.length; i++) {
                event.target.parentNode.children[4].children[i].style.display = "none";
            }
        } else if (event.target.className.includes("glyphicon-remove")) {
            if (event.target.parentNode.children[1].nodeName != 'INPUT') {
                event.target.parentNode.parentNode.removeChild(event.target.parentNode);
            } else {
                if (event.target.parentNode.className.includes('newpaper')) {
                    event.target.parentNode.parentNode.removeChild(event.target.parentNode);
                } else {
                    event.target.parentNode.innerHTML = `<span class="glyphicon glyphicon-plus-sign papermanagesecondorder" aria-hidden="true"></span>${tzpapermanagewait}
            <span class="glyphicon glyphicon-plus papermanagesecondorder" aria-hidden="true"></span>
                  <span class="glyphicon glyphicon-minus papermanagesecondorder" aria-hidden="true"></span>
                  <span class="glyphicon glyphicon-pencil papermanagesecondorder" aria-hidden="true"></span><ul>${event.target.parentNode.children[5].innerHTML}</ul>`;
                }
            }
        } else if (event.target.className.includes("glyphicon-ok")) {
            if (event.target.parentNode.children[1].nodeName != 'INPUT') {
                event.target.classList.remove('glyphicon-ok');
                event.target.classList.add('glyphicon-minus');
                event.target.previousElementSibling.classList.remove('glyphicon-remove');
                event.target.previousElementSibling.classList.add('glyphicon-plus');
            } else {
                if (event.target.parentNode.children[1].value != "") {
                    console.log(77777);
                    let str = event.target.parentNode.children[1].value;
                    console.log(event.target.parentNode.children[5]);
                    let str5 = event.target.parentNode.children[5].innerHTML;
                    event.target.parentNode.removeChild(event.target.previousElementSibling.previousElementSibling);
                    event.target.parentNode.removeChild(event.target.previousElementSibling.previousElementSibling);
                    event.target.parentNode.classList.remove("newpaper");
                    event.target.parentNode.innerHTML = `<span class="glyphicon glyphicon-plus-sign papermanagesecondorder" aria-hidden="true"></span>
          ${str}
          <span class="glyphicon glyphicon-plus papermanagesecondorder" aria-hidden="true"></span>
                  <span class="glyphicon glyphicon-minus papermanagesecondorder" aria-hidden="true"></span>
                  <span class="glyphicon glyphicon-pencil papermanagesecondorder" aria-hidden="true"></span><ul>${str5}</ul>`;
                }
            }
        } else if (event.target.className.includes("glyphicon-pencil")) {
            if (event.target.nextElementSibling.childNodes.length != 0) {
                for (let i = 0; i < event.target.nextElementSibling.children.length; i++) {
                    event.target.nextElementSibling.children[i].style.display = "none";
                }
            }
            tzpapermanagewait = event.target.parentNode.innerText;
            console.log(tzpapermanagewait);
            event.target.previousElementSibling.classList.remove("glyphicon-minus");
            event.target.previousElementSibling.classList.add("glyphicon-ok");
            event.target.previousElementSibling.previousElementSibling.classList.remove("glyphicon-plus");
            event.target.previousElementSibling.previousElementSibling.classList.add("glyphicon-remove");
            for (let i = 0; i < event.target.parentNode.childNodes.length; i++) {
                if (event.target.parentNode.childNodes[i].nodeName == 'SPAN' && event.target.parentNode.childNodes[i].className.includes('glyphicon-remove')) {
                    break;
                } else {
                    event.target.parentNode.removeChild(event.target.parentNode.childNodes[i]);
                    i--;
                }
            }
            event.target.parentNode.innerHTML =
                `<span class="glyphicon glyphicon-plus-sign papermanagesecondorder" aria-hidden="true"></span>
          <input type="text">` +
                event.target.parentNode.innerHTML;
        } else if (event.target.className.includes("glyphicon-plus")) {
            for (let i = 0; i < event.target.parentNode.children[4].children.length; i++) {
                event.target.parentNode.children[4].children[i].style.display = "block";
            }
            let str6 = event.target.parentNode.children[4].innerHTML;
            event.target.parentNode.removeChild(event.target.parentNode.children[4]);
            event.target.parentNode.innerHTML += `<ul>${str6}<li style="display:block"><input type="text" class="tzpapermanageinput3">
       <span class="glyphicon glyphicon-remove papermanagethirdorder" aria-hidden="true"></span>
       <span class="glyphicon glyphicon-ok papermanagethirdorder" aria-hidden="true"></span></li></ul>`;
        } else if (event.target.className.includes("glyphicon-minus")) {
            event.target.classList.remove("glyphicon-minus");
            event.target.classList.add("glyphicon-check");
            event.target.previousElementSibling.previousElementSibling.classList.remove("glyphicon-plus-sign");
            event.target.previousElementSibling.previousElementSibling.classList.add("glyphicon-minus-sign");
            for (let i = 0; i < event.target.nextElementSibling.nextElementSibling.children.length; i++) {
                event.target.nextElementSibling.nextElementSibling.children[i].style.display = 'block';
                let str8 = event.target.nextElementSibling.nextElementSibling.children[i].innerText;
                event.target.nextElementSibling.nextElementSibling.children[i].innerHTML =
                    str8 +
                    ` <span class="glyphicon glyphicon-remove papermanagethirdorder" aria-hidden="true"></span>
       <span class="glyphicon glyphicon-ok papermanagethirdorder" aria-hidden="true"></span>`;
            }
        } else if (event.target.className.includes("glyphicon-check")) {
            event.target.classList.remove("glyphicon-check");
            event.target.classList.add("glyphicon-minus");
            for (let i = 0; i < event.target.nextElementSibling.nextElementSibling.children.length; i++) {
                event.target.nextElementSibling.nextElementSibling.children[i].removeChild(event.target.nextElementSibling.nextElementSibling.children[i].children[0]);
                event.target.nextElementSibling.nextElementSibling.children[i].removeChild(event.target.nextElementSibling.nextElementSibling.children[i].children[0]);
            }
        }
    }
    if (event.target.className.includes("papermanagethirdorder")) {
        if (event.target.className.includes("glyphicon-ok")) {
            if (event.target.parentNode.children[0].nodeName == "INPUT") {
                let str7 = event.target.parentNode.children[0].value;
                let tzpapermanage111 = event.target.parentNode.parentNode;
                console.log(event.target.parentNode.parentNode.innerHTML);
                event.target.parentNode.parentNode.innerHTML += `<li style="display:block">${str7}</li>`;
                tzpapermanage111.removeChild(tzpapermanage111.children[tzpapermanage111.children.length - 2]);
            } else {
                event.target.parentNode.removeChild(event.target.previousElementSibling);
                event.target.parentNode.removeChild(event.target);
            }
        } else if (event.target.className.includes("glyphicon-remove")) {
            event.target.parentNode.parentNode.removeChild(event.target.parentNode)
        }
    }
});
